const log4js = require("log4js");
// const log4js_extend = require("log4js-extend");

// log4js_extend(log4js, {
//     path: __dirname,
//     format: "at @name (@file:@line:@column)"
// });

log4js.configure({
    appenders: {
        console: {
            type: 'console',
            // layout: {
            //     type: 'pattern',
            //     pattern: '[%r][%c][%p]'
            // }
        },
        file: { 
            type: 'file', 
            filename: './log/wss.log', 
            maxLogSize: 10485760, 
            backups: 3, 
            compress: true ,
            // layout:{
            //     type: 'pattern',
            //     pattern:'[%r][%c][%p]'
            // }
    }
    },
    categories: { 
        default: { appenders: ['console'], level: 'debug' },
        wss: { appenders: ['file', 'console'], level: 'debug' }
    }
});

function createLogger(name) {
    const logger = log4js.getLogger(name);
    logger.level = "info";
    return logger;
}

const logger = createLogger("sdfdf");

logger.debug("Test log");
